package com.csgsystems.im.module.action.example;

import com.csgsystems.im.survey.Survey;

public class ViewAction extends ExampleBaseAction {


	/**
	 *
	 */
	private static final long serialVersionUID = -800949457164560512L;

	private Long id = null;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Override
	public String execute() throws Exception {
		String returnValue = ERROR;
		
		try {
			Survey view = surveyDao.findById(id);
			getSession().setAttribute("entityModel", view);	// Used for UpdateAction.
			
			this.name = view.getName();
			this.vxml = view.getVxml();
			this.numberOfQuestions = view.getNumberOfQuestions();
			this.category = view.getCategory();
			this.status = view.getStatus();
			this.type = view.getType();
			this.hierarchyItemId = view.getHierarchyItemId();
			this.resultFollowup = view.isResultFollowup();
			this.displayResultAverage = view.isDisplayResultAverage();
            this.voiceRecording = view.getVoiceRecording();
			returnValue = SUCCESS;
			
		} catch (Exception e) {
			addActionError(e.getMessage());
			
		}
		return returnValue;

	}

}
